package com.hayabusa.dto;

import java.io.Serializable;

/**
 * 本类用来演示: 后端返回json数据给前端 - 结果的内容以及格式接口文档制定期间就要确定好
 *
 * @author: success
 * @date: 2021/4/8 8:05 上午
 */
public class Result implements Serializable {
    private String code;//状态码200,404,500,405...   http状态码

    private String msg;//备注,比如删除成功,查询成功...

    //java.lang.Object,一切类的基类,父类,超类.
    //所有的类都直接或者间接继承这个Object类
    private Object object;//如果进行的是查询操作,需要将查询的结果返回给前端

    public Result() {
    }

    public Result(String code, String msg, Object object) {
        this.code = code;
        this.msg = msg;
        this.object = object;
    }

    public Result(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Result{");
        sb.append("code='").append(code).append('\'');
        sb.append(", msg='").append(msg).append('\'');
        sb.append(", object=").append(object);
        sb.append('}');
        return sb.toString();
    }
}
